﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="True" CodeBehind="EditStylesheet.aspx.cs" Inherits="Cms.Web.UI.Admin.EditStylesheet" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript" src="Admin/edit_area/edit_area_loader.js"></script>
    <script language="javascript" type="text/javascript">
        //<![CDATA[
        editAreaLoader.init({
            id: "txtCode",
	        syntax: "css",
	        start_highlight: true,
	        allow_resize: "no",
	        allow_toggle: false,
	        toolbar: "undo,redo,change_smooth_selection,reset_highlight,highlight,syntax_selection",
	        word_wrap: true,
	        replace_tab_by_spaces: 4
	    });
        
	    function updateCode() {
	        txtCode = document.getElementById("txtCode");
	        txtCode.value = editAreaLoader.getValue("txtCode");
	        document.getElementById("ctl00_body_hidCode").value = txtCode.value;
	    }

	    function setCodeEditorHeight() {
	        var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	        var codeContainer = document.getElementById("codeContainer");
	        var height = viewportHeight - iLib.Pos.FindY(codeContainer) - 65;
	        height = height < 100 ? 100 : height;
	        codeContainer.style.height = height + "px";
	    }

	    function init() {
	        setCodeEditorHeight();
	        txtCode = document.getElementById("txtCode");
	        txtCode.value = document.getElementById("ctl00_body_hidCode").value;
	    }
	    //]]>
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="buttons" runat="server">
    <asp:LinkButton ID="lbSaveAndReturn" runat="server" OnClick="lbSaveAndReturn_Click" CssClass="orangeButton" OnClientClick="updateCode();"><span><span><img src="Admin/Img/icons/disk_go.png" alt="" /><span><cms:LocalizedLiteral ID="llSaveAndReturn" runat="server" /></span></span></span></asp:LinkButton>
    <asp:LinkButton ID="lbSave" runat="server" OnClick="lbSave_Click" CssClass="orangeButton" OnClientClick="updateCode();"><span><span><img src="Admin/Img/icons/disk.png" alt="" /><span><cms:LocalizedLiteral ID="llSave" runat="server" /></span></span></span></asp:LinkButton>
    <asp:HyperLink ID="hlCancel" runat="server" CssClass="orangeButton"><span><span><img src="Admin/Img/icons/delete.png" alt="" /><span><cms:LocalizedLiteral ID="llCancel" runat="server" /></span></span></span></asp:HyperLink>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="body" runat="server">
    <asp:Literal ID="litIcon" runat="server" Visible="false" Text="Admin/Img/Icons/css_edit.png" />

    <asp:Panel ID="pnlProperties" runat="server">
        <asp:UpdatePanel ID="upnlProperties" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <table class="editForm">
                    <tr>
                        <td><cms:LocalizedLiteral ID="llName" runat="server" />:</td>
                        <td><asp:TextBox ID="txtName" runat="server" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llContext" runat="server" />:</td>
                        <td><asp:DropDownList ID="ddlContexts" runat="server" /></td>
                    </tr>
                </table>
                <input type="hidden" id="hidCode" runat="server" />
            </ContentTemplate>
        </asp:UpdatePanel>
        <br />
        <div id="codeContainer" style="height: 400px;">
            <textarea id="txtCode" cols="10" rows="10" style="width: 100%; height: 100%;"></textarea>
        </div>
    </asp:Panel>
    <script language="javascript">
        //<![CDATA[
        iLib.Dom.AddListener(window, "load", init);
        //]]>
    </script>
</asp:Content>
